# from __future__ import absolute_import, unicode_literals
import os
from celery import Celery, platforms



os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Novel.settings')

# 使用RabbitMQ作为消息代理
app = Celery('Novel', 
             broker='amqp://guest:guest@localhost:5672//',  # RabbitMQ配置
             backend='redis://127.0.0.1:6379/15')  # 结果存储在Redis中

app.config_from_object('django.conf:settings', namespace='CELERY')

# 自动发现任务
app.autodiscover_tasks(['base', 'reservation'])

# 允许在root用户下运行Celery
platforms.C_FORCE_ROOT = True

